<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getContextPath() + '/'}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
    <!-- Reset Stylesheet -->
    <link rel="stylesheet" href="resources/css/reset.css" type="text/css"
          media="screen" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="resources/css/style.css" type="text/css"
          media="screen" />
    <link rel="stylesheet" href="resources/css/invalid.css" type="text/css"
          media="screen" />

    <!--                       Javascripts                       -->
    <!-- jQuery -->
    <script type="text/javascript"
            src="resources/scripts/jquery-1.3.2.min.js"></script>
    <!-- jQuery Configuration -->
    <script type="text/javascript"
            src="resources/scripts/simpla.jquery.configuration.js"></script>

    <script>
        /**
         * search搜索
         */
        function search(){
            //获得搜索关键词
            var value = $("#requestId").val();
            if(value == ""){
                alert("关键字不能为空！");
                return;
            }

            $.ajax({
                url: "runlog/search",
                data: {"reqId": value},
                success: function(datas){
                    if(datas.code == "200"){
                        var data = datas.data;

                        var html = "";

                        for(var i = 0; i < data.length; i++){
                            html += "<hr>";
                            html += "<li>";
                            html += "请求顺序：" + data[i].order + "<br/>";
                            html += "请求标识：" + data[i].requestId + "<br/>";
                            html += "请求url：" + data[i].url + "<br/>";
                            html += "执行类全路径：" + data[i].className + "<br/>";
                            html += "执行方法：" + data[i].methodName + "<br/>";
                            html += "执行参数：" + "<br/>";
                            if(data[i].params != null){
                                for(var key in data[i].params){
                                    html += "&nbsp;&nbsp;&nbsp;&nbsp;" + key + "-->" + data[i].params[key] + "<br/>";
                                }
                            }
                            html += "返回值：" + data[i].result + "<br/>";
                            html += "<font color='red'>异常信息：" + data[i].throwInfo + "</font><br/>";
                            html += "执行时间：" + data[i].time + "<br/>";
                            html += "</li>";
                        }

                        $("#ul").html(html);
                    }
                },
                dataType: "json"
            });
        }
    </script>
</head>
<body>
<div id="main-content">
    <div class="content-box">
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <h2>运行日志搜索</h2>

            <form id="formid">
                <p>
                    请求标识：
                </p>
                <p>
                    <input
                            class="text-input small-input" type="text"
                            name="requestId" id="requestId" placeholder="请输入请求标识"/>
                </p>
                <p>
                    <button type="button" class="mybutton" onclick="search();">搜索</button>
                </p>
            </form>

            <br/>
            <hr/>
            <br/>

            <div class="tab-content default-tab" id="result">
                <ul id="ul">
                </ul>
            </div>
        </div>
        <!-- End .content-box-content -->
    </div>
</div>
<!-- End #main-content -->
</body>
</html>